/**
 * 
 */
package secondary_classes;

import java.util.Comparator;

/**
 * @author Rohit
 *
 */
public class OrdersComparatorDateTime implements Comparator<Order> {
	
	
	@Override
	public int compare(Order arg0, Order arg1) {
		int result = 0;
		
		if (arg0.getDate().equals(arg1.getDate())) {
			if (arg0.getTime().before(arg1.getTime())) {
				result = -1;
			} else if (arg0.getTime().after(arg1.getTime())) {
				result = 1;
			}
		} else if (arg0.getDate().before(arg1.getDate())) {
			result = -1;
		} else if (arg0.getDate().after(arg1.getDate())) {
			result = 1;
		}
		
		return result;
	}

}
